<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>家庭书籍管理系统</title>
<link rel="stylesheet" href="css/thin_table.css">
</head>
<body>
<table width="100%" border="0">
	<tr>
		<td>书籍管理 &gt;&gt;&gt;</td>
		<td align="right"><a href="/book_add.zweb?page_size=20&page_no=1">书籍列表</a> |
			<a href="/book_add.zweb?page_size=$$(PAGE_SIZE)&page_no=$$(PAGE_NO)">添加书籍</a></td>
	</tr>
</table>
<br />
<form id="formModifyBook" name="formModifyBook" method="post" action="/book_modifying.zweb?book_id=$$(BOOK_ID)&page_size=$$(PAGE_SIZE)&page_no=$$(PAGE_NO)">
	<table class="thin_table" align="center">
		<tr class="thin_table_tr">
			<td colspan="4"><div align="center"><strong>修改书籍信息</strong></div></td>
		</tr>
		<tr class="thin_table_tr">
			<td><div align="right">书籍分类：</div></td>
			<td colspan="3"><select name="selectBookClass" id="selectBookClass">
				
					$$[BOOK_CLASS/
					
				<option value="$$(BOOK_CLASS_CODE)" $$(BOOK_CLASS_SELECTED)>$$(PREFIX_AND_BOOK_CLASS_NAME)</option>
				
					$$/BOOK_CLASS]
				
			</select>			</td>
		</tr>
		<tr class="thin_table_tr">
			<td><div align="right">书名：</div></td>
			<td colspan="3"><input name="textfieldBookTitle" type="text" id="textfieldBookTitle" size="130" maxlength="130" value="$$(BOOK_TITLE)" /></td>
		</tr>
		<tr class="thin_table_tr">
			<td><div align="right">作者：</div></td>
			<td><input name="textfieldBookAuthor" type="text" id="textfieldBookAuthor" size="60" maxlength="130" value="$$(BOOK_AUTHOR)" /></td>
			<td><div align="right">出版社：</div></td>
			<td><input name="textfieldBookPublisher" type="text" id="textfieldBookPublisher" size="60" maxlength="100" value="$$(BOOK_PUBLISHER)" /></td>
		</tr>
		<tr class="thin_table_tr">
			<td><div align="right">版次：</div></td>
			<td><input name="textfieldBookEdition" type="text" id="textfieldBookEdition" size="16" maxlength="16" value="$$(BOOK_EDITION)" /></td>
			<td><div align="right">价格：</div></td>
			<td><input name="textfieldBookPrice" type="text" id="textfieldBookPrice" size="8" maxlength="8" value="$$(BOOK_PRICE:%.2f)" />
元 </td>
		</tr>
		<tr class="thin_table_tr">
			<td><div align="right">书架：</div></td>
			<td><select name="selectBookShelf" id="selectBookShelf" onchange="onChangeBookShelf();">
				
					$$[BOOK_SHELF/
					
				<option value="$$(BOOK_SHELF_ID)" $$(BOOK_SHELF_SELECTED)>$$(BOOK_SHELF_DESC)</option>
				
					$$/BOOK_SHELF]
				
			</select>			</td>
			<td><div align="right">书架层：</div></td>
			<td><select name="selectBookShelfLayer" id="selectBookShelfLayer">
				
					$$[BOOK_SHELF_LAYER/
					
				<option value="$$(BOOK_SHELF_LAYER_NUMBER)" $$(BOOK_SHELF_LAYER_SELECTED)>$$(BOOK_SHELF_LAYER_DESC)</option>
				
					$$/BOOK_SHELF_LAYER]
				
			</select>			</td>
		</tr>
		<tr class="thin_table_tr">
			<td><div align="right">标签备注：</div></td>
			<td colspan="3"><input name="textfieldLabelRemark" type="text" id="textfieldLabelRemark" size="32" maxlength="32" value="$$(LABEL_REMARK)" /></td>
		</tr>
		<tr>
			<td colspan="4"><div align="right">
				<input name="hiddenBookId" type="hidden" id="hiddenBookId" value="$$(BOOK_ID)"  />
				<input name="hiddenPageSize" type="hidden" id="hiddenPageSize" value="$$(PAGE_SIZE)"  />
				<input name="hiddenPageNo" type="hidden" id="hiddenPageNo" value="$$(PAGE_NO)"  />			
				<input type="button" name="buttonReturnList" id="buttonReturnList" value="   返回书籍信息   " onClick="document.location.href='/book_info.zweb?book_id=$$(BOOK_ID)&page_size=$$(PAGE_SIZE)&page_no=$$(PAGE_NO)';" />
				<input type="submit" name="buttonAddBook" id="buttonAddBook" value="   修改   " />			
			</div></td>
		</tr>
	</table>
</form>
<script language="javascript">
	function onChangeBookShelf() {
		var book_shelf = document.getElementById( 'selectBookShelf' ) ;
		
		var xhr = new XMLHttpRequest() ;
		xhr.open( 'GET' , '/book_shelf_layer_data.zweb?book_shelf_id='+book_shelf.value , true );
		xhr.responseType = 'json' ;
		xhr.onreadystatechange = function() {
			if( xhr.readyState == 4 && xhr.status == 200 ) {
				var selectBookShelfLayer = document.getElementById( 'selectBookShelfLayer' ) ;
				selectBookShelfLayer.innerHTML = '' ;
				xhr.response.forEach( function(item) {
					var option = document.createElement('option') ;
					option.value = item.book_shelf_layer_number ;
					option.textContent = item.book_shelf_layer_desc ;
					selectBookShelfLayer.appendChild(option);
				});
			}
		}
		xhr.onerror = function() {
			alert( 'Network error' );
		}
		xhr.send();
	}
</script>
</body>
</html>
